﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MergeInfo.Modal.DAO;
using MergeInfo.Modal.Entity;
using MergeInfo.Modal.Exception;
using MergeInfo.Modal.Interface.IBLL;
using MergeInfo.Modal.Interface.IDAO;

namespace MergeInfo.Modal.BLL
{
    public class WebsiteBll : IWebsiteBll
    {
        private readonly IWebsiteDao _websiteDao;

        public WebsiteBll()
        {
            _websiteDao = new WebsiteDao();
        }

        public WebsiteEntity GetInfo(Guid id)
        {
            IList<WebsiteEntity> websiteEntities = _websiteDao.Select(id);
            if (websiteEntities.Count > 1)
                throw new WebsiteException("数据异常：站点重复");
            if (websiteEntities.Count == 1)
                return websiteEntities[0];
            return null;
        }
    }
}
